# pip install redis
import redis

def connec_redis():
    # 1. 获取连接
    client = redis.StrictRedis(host='127.0.0.1', port=6379)
    # 2. 设置key
    key = 'name'
    # 3.string 增加
    # result = client.set(key, "zhangsan")
    # print(result)
    # 4.string 删除
    # reslut = client.delete(key)
    # 5.string 修改
    # result = client.set(key, '李四')   # 覆盖
    # 6.string 查找   --- 字节
    result = client.get(key)
    result = client.keys()   #  查看所有的keys   支持正则写法的
    print(result)



connec_redis()